package com.controller.sys;

import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
 

/**
 * @author Administrator
 * 
 */
@Controller("sysTestController")
public class TestController {
	static final Logger logger = LoggerFactory.getLogger(TestController.class);

	@RequestMapping("/sys/testeasyui")
	public Map<String, String> getMap() {
		Map<String, String> map = new HashMap<String, String>();
		map.put("key1", "value-1");
		map.put("key2", "value-2");
		map.put("key3", "value-2");
		return map;
	}

	@RequestMapping(value = "/test/export", produces = "text/json;charset=UTF-8")
	public void getAddInfoAll(HttpServletRequest request, HttpServletResponse response) {
		OutputStream out = null;
		try {
			out = response.getOutputStream();
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		List<List<String>> list = new ArrayList<List<String>>();
		List<String> list0 = new ArrayList<String>();
		list0.add("1");
		list.add(list0);
//		EasyExcelUtils.write0(out, list);
		response.setCharacterEncoding("utf-8");
		response.setHeader("Content-Disposition", "attachment; filename=log.xlsx");
		try {
			out.flush();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
